<template>
    <div class="footer">
         <ul>
            <li @click="footerNavTo(0)"
                :class="{'active': switchNav('/home') }"
            >
                <div>
                    <span>&#xe65f;</span><br>
                    首页
                </div>
            </li>
            <li @click="footerNavTo(1)"
                :class="{'active': footerNav===1}"
            >
                <div>
                    <span>&#xe6c2;</span><br>
                    动态
                </div>
            </li>
            <li>
                <span class="push-btn">
                    +
                </span>
            </li>
            <li @click="footerNavTo(2)"
                :class="{'active': footerNav===2}"
            >
                <div>
                    <span>&#xe667;</span><br>
                    会员购
                </div>
            </li>
            <li @click="footerNavTo(3)"
                :class="{'active': switchNav('/myPage')}"
            >
                <div>
                    <span>&#xe6c8;</span><br>
                    我的
                </div>
            </li>
        </ul>
    </div>
</template>

<script>

import { useRouter } from "vue-router";

export default {
    name: 'FooterNav',
    props:['footerNav', 'footerNavTo'],
    methods:{
        /* 判断是否切换导航UI */
        switchNav(path){
            if(useRouter().currentRoute.value.fullPath === path){
                return true
            }
            return false
        }
    }
}
</script>

<style scoped>
.footer {
    height: 60px;
    position: fixed;
    left: 0;
    bottom: 0;
    border-top: 1px solid rgb(146, 146, 146);
}

ul {
    width: 100vw;
    height: 50px;
    float: left;
    display: flex;
}

ul li {
    flex: 1;
    text-align: center;
    font-size: 12px;
    padding: 5px;
}

ul li:active{
    background-color: rgba(129, 129, 129, 0.3);
    transition: all 0.2s;
}

ul li span{ 
    font-family: "icon-footer" !important;
    font-size: 23px;
    line-height: 1.1em;
}


.active {
    color: rgb(233, 93, 116);
}

.push-btn {
    font-size: 25px;
    text-align: center;
    line-height: 1.4em;
    color: rgb(255, 255, 255);
}
.push-btn::before {
    content: '';
    position: absolute;
    height: 40px;
    width: 45px;
    background-color: palevioletred;
    background-image: linear-gradient(rgb(252, 128, 180), rgb(219, 50, 107));
    z-index: -1;
    border-radius: 15px;
    transform: translate(-13px);
}
</style>
